package ilearn.job.disserver.sdk.account.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import ilearn.job.disserver.sdk.account.dto.AccountDTO;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.support.converter.DefaultJackson2JavaTypeMapper;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

@Configuration
public class RabbitMQConfigration {

    public static final String TopicExchangeName ="account-sdk-mq-exchange";
    public static final String QueueName = "account-sdk-mq-queue";
    public static final String RouteKey = "account.sdk.route.update";

    @Bean
    public Queue queue(){
        return new Queue(QueueName,false);
    }

    @Bean
    public Exchange exchange(){
        return new TopicExchange(TopicExchangeName);
    }

    @Bean
    public Binding binding(Queue queue,Exchange exchange){
        return BindingBuilder.bind(queue).to(exchange).with(RouteKey).noargs();
    }

}
